package edu.tjufe.llp.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.tjufe.llp.entity.ChargeArea;
import edu.tjufe.llp.entity.Station;
import edu.tjufe.llp.mapper.ChargeAreaMapper;
import edu.tjufe.llp.mapper.StationMapper;
import edu.tjufe.llp.service.IStationService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 充电桩Service业务层处理
 *
 * @author ruoyi
 * @date 2022-12-23
 */
@Service
public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements IStationService
{
    @Resource
    private StationMapper stationMapper;

    /**
     * 查询充电桩
     *
     * @param stationId 充电桩主键
     * @return 充电桩
     */
    @Override
    public Station selectStationByStationId(Integer stationId)
    {
        return stationMapper.selectStationByStationId(stationId);
    }

    /**
     * 查询充电桩列表
     *
     * @param station 充电桩
     * @return 充电桩
     */
    @Override
    public List<Station> selectStationList(Station station)
    {
        return stationMapper.selectStationList(station);
    }

    /**
     * 新增充电桩
     *
     * @param station 充电桩
     * @return 结果
     */
    @Override
    public int insertStation(Station station)
    {
        return stationMapper.insertStation(station);
    }

    /**
     * 修改充电桩
     *
     * @param station 充电桩
     * @return 结果
     */
    @Override
    public int updateStation(Station station)
    {
        return stationMapper.updateStation(station);
    }

    /**
     * 批量删除充电桩
     *
     * @param stationIds 需要删除的充电桩主键
     * @return 结果
     */
    @Override
    public int deleteStationByStationIds(Integer[] stationIds)
    {
        return stationMapper.deleteStationByStationIds(stationIds);
    }

    /**
     * 删除充电桩信息
     *
     * @param stationId 充电桩主键
     * @return 结果
     */
    @Override
    public int deleteStationByStationId(Integer stationId)
    {
        return stationMapper.deleteStationByStationId(stationId);
    }

    @Override
    public Page<Station> findPage(Page<Station> page, String stationCode,Integer areaId,String state) {
        return stationMapper.findPage(page,stationCode,areaId,state);
    }
}
